package JUnit4;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;


public class LiczbaTest
{

	Liczba lb21 = null;
	static Liczba lb = null;
	Liczba lbUjemna;
	
	@BeforeClass
	public static void setUpBeforeClass() throws Exception
	{
		lb = new Liczba(56);
	}

	@AfterClass
	public static void tearDownAfterClass() throws Exception
	{
		lb = null;
	}

	@Before
	public void setUp() throws Exception
	{
		lb21 = new Liczba(21);
	}

	@After
	public void tearDown() throws Exception
	{
		lb21 = null;
	}

	@Test
	public void test21_2() throws ZlaPodstawaException
	{
		String str = lb21.zamien(2);
		assertEquals(str, "10101");
	}
	@Test(expected = ZlaPodstawaException.class)
	public void test21_17() throws ZlaPodstawaException
	{
		String str = lb21.zamien(17);
	}
	@Test(timeout = 100)
	public void test21_16() throws ZlaPodstawaException
	{
		String str = lb21.zamien(16);
		assertEquals(str, "15");
	}
	
	@Test
	public void testOne() throws NieNaturalnyException, ZlaPodstawaException {
		this.lb21 = new Liczba(1);
		assertEquals("wrong convert one", "1", this.lb21.zamien(4));
	}
	
	@Ignore
	@Test
	public void testNieNaturalnyException(){
		try{
			this.lbUjemna = new Liczba(-3);
			fail("Oczekiwano NieNaturalnyException");
		}
		catch(NieNaturalnyException succes){};
	}
	
}
